﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.woodsoft.core;
using EQ1.Elements;
using com.woodsoft.core.Files;
using EQ1.Objects;

namespace EQ1.Controls {
  public class Slider : Control , IUIElement<Slider> {
    public Slider ( UIDocument doc , string name )
      : base( doc , name ) {
    }
    public Slider ( UIDocument doc )
      : this( doc , "Slider" ) {
    }

    #region IUIElement<Slider> Members

    public void Validate ( Slider val , string name ) {
      UIClass par = ( UIClass ) this.ParentNode;

      if( val.LocalName != name ) {
        Slider el = new Slider( ( UIDocument ) val.OwnerDocument , name );
        el.Copy( val );
        val = el;
      }

      if( par.GetElement( name ) != null )
        par.RemoveElement( name );

      par.AppendChild( val );
    }
    public void Copy ( Slider val ) {
      base.Copy( val );

      this.SliderArt = val.SliderArt;
    }

    #endregion

    public string SliderArt {
      get {
        return this.GetElement( "SliderArt" ).InnerText;
      }
      set {
        this.Validate( "SliderArt" , value );
      }
    }
  }
}
